Skip to content

Add GCP OpenTelemetry plugin#1658

Draft
eamsden wants to merge 2 commits into
mainfrom
ea/gcp-opentelemetry-plugin
Draft

Add GCP OpenTelemetry plugin#1658
eamsden wants to merge 2 commits into
mainfrom
ea/gcp-opentelemetry-plugin

Conversation

@eamsden

@eamsden eamsden commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add temporalio.contrib.gcp.OpenTelemetryPlugin, a thin GCP-focused wrapper around the existing OpenTelemetry plugin
  • export workflow traces and Core metrics over OTLP/gRPC to a local collector sidecar, with Cloud Run-aware service-name defaults
  • default Core metric exports to 60 seconds, matching the coordinated Java/Go/Python and upstream OpenTelemetry SDK cadence, while preserving metric_periodicity= overrides
  • keep tracer-provider and runtime ownership explicit, including trace flush/shutdown helpers and worker-stop opt-in
  • document separate Google collector pipelines: cumulative metrics without batching, traces with a dedicated batch processor
  • add the gcp-opentelemetry dependency extra, usage documentation, and focused tests

The worker does not use Google Cloud clients, exporters, or resource detection directly. The collector is responsible for authenticating, enriching telemetry with GCP resource attributes, and exporting it to Google Cloud.

Google Managed Service for Prometheus must receive each cumulative OTLP metric export separately. A collector batch processor can combine a periodic export with a shutdown-time export and cause Duplicate TimeSeries rejection regardless of the configured periodicity. Trace batching remains safe and recommended.

Related implementations

Validation

  • 59 original focused and regression tests passed
  • 13 GCP plugin tests passed after the cadence change, including a literal 60-second default assertion and an explicit 30-second override assertion
  • ruff check and ruff format --check for the GCP implementation/tests
  • pyright, mypy, and basedpyright for the GCP implementation/tests
  • documentation generation and uv lock --check
  • Cloud Run worker-pool and Temporal Cloud E2E verified workflow execution, the unoverridden 60-second metrics cadence, metrics and trace export, GCP resource attribution, and clean shutdown without duplicate-series or exporter errors

The Python runtime currently has no public explicit Core-metrics force-flush API. The no-batch metrics guidance prevents a periodic and runtime-shutdown export from being combined if such an export occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant